/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.usecase.figure;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;

import com.cea.papyrus.core.PapyrusPlugin;
import com.cea.papyrus.core.figures.LabelFigure;

/**
 * Defines the view of an extension point.
 * 
 * @author Gilles Cannenterre
 * @since 9 oct. 06
 */
public class ExtensionPointFigure extends LabelFigure {

	/**
	 * The name.
	 */
	protected String name = "";

	/**
	 * The stereotypes.
	 */
	protected String stereotypeList = "";

	/**
	 * The Constructor.
	 */
	public ExtensionPointFigure() {
		FontData[] font = { new FontData("Arial", 9, SWT.NORMAL) };
		setFont(PapyrusPlugin.fontManager.get(font));
		setLabelAlignment(PositionConstants.LEFT);
	}

	/**
	 * to add stereotypes.
	 * 
	 * @param name of the operation
	 * @param st the st
	 */
	@Override
	public void setStereotypes(String st) {
		if (st == null) {
			this.stereotypeList = "";
		} else {
			this.stereotypeList = PapyrusPlugin.ST_LEFT + st
					+ PapyrusPlugin.ST_RIGHT;
		}
		display();
	}

	/**
	 * Sets the name.
	 * 
	 * @param name the name
	 */
	@Override
	public void setName(String name) {
		this.name = name;
		display();
	}

	/**
	 * Display.
	 */
	protected void display() {
		setText(stereotypeList + name);
	}

	/**
	 * Paint border.
	 * 
	 * @param graphics the graphics
	 */
	@Override
	public void paintBorder(Graphics graphics) {
	}
}